package guoanmaker.personal.business.dao;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

import org.springframework.stereotype.Repository;

import guoanmaker.personal.business.model.KeyValue;

@Repository
public class KeyValueDao {
	
	@PersistenceContext
	EntityManager em;
	
	/**
	 * 
	* @Description: 根据key查询value 
	* @param  key
	* @param @return
	* @author Yvonne_MGL 
	* @date 2018年3月12日 上午10:45:36     
	* @return List<KeyValue>    
	* @throws 
	 */
	public String findValue(String key){
		String value=null;
		String jpql="select k from KeyValue k where k.keyss='"+key+"'";
		Query query = em.createQuery(jpql);
		List<KeyValue> list=query.getResultList();
		if(list!=null&&list.size()>0){
			value=list.get(0).getValuess();
		}
		return value;
	}

}
